
/*
 * 退出弹出层
 */
function closeLayer(){
    parent.layer.closeAll();
}

/**
*表单提交
*/
function saveForm(){
	var allotType = $("#allotType").val(),
	allotUserId = $("#allotUserId").val();
	if(null==allotType||""==allotType){
		DGG.layer.msg("请选择分配类型",{icon: '2'});
		//layer.closeAll();
		return false;
	}
	if(null==allotUserId||""==allotUserId){
		DGG.layer.msg("请选择分配人",{icon: '2'});
		//layer.closeAll();
		return false;
	}
	DGG.Layer.loading.start();
	var data = $("#data-form").serialize();
	$.ajax({
        url: sysInfo.basePath + '/sc/general/bid/doAllot.do?scProductOrderId='+$("#mainId").val(),
        data: data,
        type: "POST",
        dataType: "json",
        success: function (obj) {
        	DGG.Layer.loading.done();
            if (obj.code != 0) {
                DGG.Layer.message(obj.msg, {icon: '2'}, function () {
                	window.parent.parent.dataTableReload();
                });
            } else {
                DGG.Layer.message('操作成功！', {icon: '1'}, function () {
                    window.parent.parent.dataTableReload();
                    window.parent.parent.layer.closeAll();
                });
            }
        }
    });
}
/**
 * 下拉框触发事件
 * @param e
 * @returns
 */
function initAllotUserName(e){
	var userName = $(e).find('option:selected').text();
	$("#allotUserName").val(userName);
}